<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/style/css/pageCommon.css" />
<script language="javascript" src="${pageContext.request.contextPath}/script/jquery.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/script/commonUtils.js" charset="utf-8"></script>
<%-- <script language="javascript" src="${pageContext.request.contextPath}/script/user.js" charset="utf-8"></script> --%>
</head>
<script type="text/javascript" async="async">

var memberId = '${memberId}';
var sessionKey = '${sessionKey}';
var sessionId = '${sessionId}';
var page;
var pageNum=1;
var pageSize=20;

$(function(){
	var pNum=$("input[name='pageNum']").val();
	pageNum=pNum==""?pageNum:pNum;
	search(pageNum);
});

function search(pageNum){
	var param={
			sessionKey:sessionKey,
			pageNum:pageNum,
			pageSize:pageSize,
			"method":"queryMessageList"};
	var url="${pageContext.request.contextPath}/common/commonController?sessionId="+sessionId;
	$.ajax({
	    url : url,
	    type : "POST",
	    async : true,
	    contentType: "application/json; charset=utf-8",
	    data : JSON.stringify(param),
	    dataType : 'json',
	    success : function(data) {
	    	if(data.resultCode=="000000"){
	    		loadPageBar(data);
	    		$("#TableData").html("");
	    		$.each(data.data.list,function(n,v){
	    			var tfont=$("#table").find("tfoot").clone();
	    			var messageId=v["id"];
	    			tfont.find("label[name='messageId']").text(messageId);
	    			tfont.find("label[name='sessionKey']").text(v["sessionKey"]);
	    			tfont.find("label[name='sender']").text(v["sender"]);
	    			tfont.find("label[name='receiver']").text(v["receiver"]);
	    			tfont.find("label[name='content']").text(v["content"]);
	    			tfont.find("label[name='modeType']").text(v["modeType"]);
	    			tfont.find("label[name='createTime']").text(v["createTime"]);
	    			$("#TableData").append(tfont.html());
	    		});
	    	}else{
	    		alert(data.resultMsg)
	    	}
	    }
	});
}

function goBack(){
	window.history.go(-1);
}


</script>
<body>

	<div id="Title_bar">
		<div id="Title_bar_Head">
			<div id="Title_Head"></div>
			<div id="Title">
				<input type="image" border="0" width="13" height="13"
					src="${pageContext.request.contextPath}/style/images/title_arrow.gif" />
					message查询
			</div>
			<div id="Title_End"></div>
		</div>
	</div>

<div id=MainArea>
<div style="padding-left: 10px;">
         <div class="ItemBlock_Title1">
         	查询条件
         </div>
		<div class="ItemBlockBorder">
			<div class="ItemBlock">
				<table cellpadding="0" cellspacing="0" class="mainForm">
					<tr>
						<td>sessionKey&nbsp;&nbsp;<input type="text" name="sessionKey" /></td>
						<td>
							 <div id="InputDetailBar" style="float: left"> 
					            <input type="image" src="${pageContext.request.contextPath}/style/images/button/query.PNG"  onclick="search(1)" />
					            <input type="image" src="${pageContext.request.contextPath}/style/images/button/goBack.png""  onclick="goBack(1)" />
					        </div>
						</td>
					</tr>
				</table>
			</div>
		</div>
		
		<table id="table" border="0" cellspacing="0" cellpadding="0" style="margin-top: 0px;width:98%" class="TableStyle">
		<div class="ItemBlock_Title1">
			查询结果
         </div>
			<thead>
				<tr align=center valign=middle id=TableTitle>
					<td >messageId</td> 
					<td >sessionKey</td> 
					<td >sender</td> 
					<td >receiver</td> 
					<td >content</td> 
					<td >modeType</td>
					<td >创建时间</td>
				</tr>
			</thead>
			<tbody id="TableData" class="dataContainer" datakey="userList">

			</tbody>
			<tfoot class="TableDetail1 template" style="display:none">
				<tr class="TableDetail1 template" align="center"  style="display:run-in">
					<td><label name="messageId"></label></td>
					<td><label name="sessionKey"></label></td>
					<td><label name="sender"></label></td>
					<td><label name="receiver"></label></td>
					<td><label name="content"></label></td>
					<td><label name="modeType"></label></td>
					<td><label name="createTime"></label></td>
				</tr>
			</tfoot>
		</table>


		<div class="ItemBlock_Title1" />
		<div>
			<div style="float: left;">
				<input type="text" name="pageNum" style="display:none"/>
				页次：<label name="pageNum" ></label>/<label name="pages" ></label>页 &nbsp;
				每页显示：<label name="pageSize" ></label>条&nbsp;总记录数：<label name="total" ></label>条&nbsp;</div>
			<input type="image" name="firstPage" src="${pageContext.request.contextPath}/style/images/btn_all_left.gif" onclick="search(this.value)" />
			<input type="image" name="prePage" src="${pageContext.request.contextPath}/style/images/btn_to_left.gif"  onclick="search(this.value)" />
			<input type="image" name="nextPage" src="${pageContext.request.contextPath}/style/images/btn_to_right.gif"  onclick="search(this.value)" />
			<input type="image" name="lastPage" src="${pageContext.request.contextPath}/style/images/btn_all_right.gif" onclick="search(this.value)"  />
		</div>
		</div>
	</div>
</body>
</html>
